import { createRouter, createWebHashHistory } from '@ionic/vue-router';
import { RouteRecordRaw } from 'vue-router';
import TabsPage from '../views/TabsPage.vue'
import LoginPage from "@/views/LoginPage.vue";

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect: '/tabs/home'
  },
  {
    path: '/login',
    component: () => import('@/views/LoginPage.vue'),
  },
  {
    path: '/setting',
    component: () => import('@/views/SettingPage.vue'),
  },
  {
    path: '/tabs/',
    component: TabsPage,
    children: [
      {
        path: '',
        redirect: '/tabs/home'
      },
      {
        path: 'home',
        component: () => import('@/views/HomePage.vue')
      },
      {
        path: 'search',
        component: () => import('@/views/SearchPage.vue'),
      },
      {
        path: 'more',
        component: () => import('@/views/MorePage.vue'),
      },
      {
        path: 'book',
        component: () => import('@/views/BookPage.vue'),
      },
      {
        path: 'comment',
        component: () => import('@/views/CommentPage.vue'),
      },
      {
        path: 'borrow',
        component: () => import('@/views/BorrowPage.vue'),
      },
      {
        path: 'password',
        component: () => import('@/views/PasswordPage.vue'),
      },
      {
        path: 'phone',
        component: () => import('@/views/PhonePage.vue'),
      },
      {
        path: 'type',
        component: () => import('@/views/TypePage.vue')
      },
      {
        path: 'my',
        component: () => import('@/views/MyPage.vue')
      }
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
